package com.pubsys.main.client.aplicacao;

import java.util.HashMap;

import com.google.gwt.user.client.ui.Widget;

/**
 * An activity instance is a class to wrap a lot of things that need 
 * to be done before instantiating a view; for instance, if we have 
 * a very complex view that needs several other views, and rpc classes connected
 * through an event bus, we build it all here, in an instance of this class,
 * and just return the view we want to show to the end user in the returning
 * method of this interface to be implemented.
 *  
 * @author Martin Reus
 *
 */
public abstract class Activity{
	
	/**
	 * Starts the activity. That is: here we should start everything before
	 * this.getWidget is calledW
	 */
	public abstract void start();
	
	/**
	 * Should be implemented in each subclass, when parameters for the activity are needed.
	 * Example: we pass an ID of a home to an activity, so this ID should be stored inside this 
	 * HashMap. When user navigates back and forth again on the browser, we have the ID as a parameter
	 * that can be used for the activity
	 * @return HashMap<String, String> has map containing parameters for this activity
	 */
	public abstract HashMap<String, String> getActivityParametersAsHashMap();
	
	/**
	 * analogous to the explanation above, this is what the activityFactory uses to pass the 
	 * browser history tokens to an instance of this class. From the example above, we would take the
	 * id parameter, and store it inside our class
	 * @param placeParameters
	 */
	public abstract void setActivityParametersFromHistoryToken(HashMap<String, String> placeParameters);
	
	/**
	 * returns a widget for this activity
	 * @return
	 */
	public abstract Widget getView();	
	
	
	
	/**
	 * Is used within ActivityFactory to determine which activity to start
	 * @return
	 */
	public abstract String getUniqueActivityName ();
}
